package com.shujia.dwd

import com.shujia.commom.SparkTool
import org.apache.spark.sql.{DataFrame, Dataset, Row, SparkSession}

object DwdGsjRegInvestorMskDay  extends SparkTool{
  /**
   * 抽象方法: 在子类中实现这个方法
   * import spark.implicits._
   * import org.apache.spark.sql.functions._
   *
   * @param spark ：spark环境
   * @param ds    ：分区
   */
  override def run(spark: SparkSession, ds: String): Unit = {
    import spark.implicits._
    import org.apache.spark.sql.functions._


    //读取hive中数据
    val investor: Dataset[Row] = spark
      .table("ods.ods_t_gsj_reg_investor")
      .where($"ds"===ds)

    val resultDF: DataFrame = investor.select(upper(md5($"id")) as "id")


    //保存数据
    save(resultDF,s"/daas/motl/dwd/dwd_gsj_reg_investor_msk_d/ds=$ds")

  }
}
